﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using PCC.Framework.DataAccess;

namespace PCC.Framework.Data
{
    public class ArchiveData
    {
        public DataTable QueryDocsByArchiveType(int archiveType)
        {
            string selectSql = "select * from document_archive";

            DBHelper dbHelper = new DBHelper(DatabaseType.ORACLE, "Data Source=orcl;User ID=archive;Password=password;Unicode=True");

            return dbHelper.ExecuteTable(selectSql);
        }

        public DataTable QueryDocsByArchiveType(int archiveType,PageInfo pageInfo,SortBy sort)
        {
            string selectSql = "select * from bulidproject_archive";
            

            DBHelper dbHelper = new DBHelper(DatabaseType.ORACLE, "Data Source=orcl;User ID=archive;Password=password;Unicode=True");

            return dbHelper.ExecutePageTable(selectSql,pageInfo, sort);
        }

        public DataTable QueryWellCatalogByParentId(string parentId)
        {
            string sql = string.Format("SELECT a.wellcatalogid ID, a.catalogdescript text, a.parentid pid, a.catelogsort, a.iswellcode from wellcatalog a where a.PARENTID='{0}'", parentId);

            DBHelper dbHelper = new DBHelper(DatabaseType.ORACLE, "Data Source=orcl;User ID=archive;Password=password;Unicode=True");

            return dbHelper.ExecuteTable(sql);
        }
    }
}
